package com.bdweb.service.impl;

import com.bdweb.dao.UserDao;
import com.bdweb.model.USER;
import com.bdweb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public List<USER> findAllUser() {
        return userDao.findAll();
    }

    @Override
    public USER findUser(String name, String pwd) {
        return userDao.findByNameAndPwd(name, pwd);
    }

    @Override
    public Integer addUser(USER user) {
        return userDao.addByUser(user);
    }

    @Override
    public Integer deleteUser(Integer id) {
        return userDao.deleteUserById(id);
    }

    @Override
    public Integer updateUserInfo(Integer id, String name, String pwd) {
        return userDao.updateNameAndPwdById(id, name, pwd);
    }
}